import React from "react";

const Gantt = (props) => {
    
    const handleClick = () => {
        // 调用API，往编辑器中插入一个数字
        props.editor.insertText(
            "```mermaid\n" +
            "gantt\ndateFormat YYYY-MM-DD\n" + 
            "section 第1阶段\n任务1: 2014-01-01, 9d\n" + 
            "section 第2阶段\n任务2: 2014-01-06, 9d\n" + 
            "section 第3阶段\n任务3: 2014-01-04, 12d\n" + 
            "```\n\n" +
            "<p>请参考<a href=\"https://github.com/mermaid-js/mermaid\" target=\"_blank\">mermaid</a>。</p>"
        );
    }

    return (
        <span
        className="button button-type-counter"
        title="甘特图"
        onClick={handleClick}
        >
        <i className="fa fa-sliders" />
        </span>
    );
}

Gantt.align = 'left';
Gantt.pluginName = 'gantt';

export default Gantt;